package com.test.random;

import java.util.Random;

public class RandomDemo {

    public static void main(String[] args) {
        // Math.random(); 生成的随机数是大于等于0小于1的浮点型数值，[0.0,1.0)
        int num = 10;
        for (int i = 0; i < num; i++) {
            System.out.println((int) ((Math.random() * 9 + 1) * 1000));
        }
        // Random
        Random random = new Random(100L);
        for (int i = 0; i < num; i++) {
            System.out.println(random.nextInt(1000));
        }
        random.ints(10, 10, 30).forEach(System.out::println);
    }
}
